package com.example.cupid.service.Impl;

import com.example.cupid.mapper.WechatMapper;
import com.example.cupid.pojo.UserWechatSava;
import com.example.cupid.pojo.UserWechatTake;
import com.example.cupid.pojo.Wechat;
import com.example.cupid.service.WechatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 2021/9/3
 **/
@Service
public class WechatServiceImpl implements WechatService {

    @Autowired
    private WechatMapper wechatMapper;

    @Override
    public List<Wechat> getSaveWechatByUserId(int id) { return wechatMapper.selectSaveWechatByUserId(id); }

    @Override
    public List<Wechat> getTakeWechatByUserId(int id) {
        return wechatMapper.selectTakeWechatByUserId(id);
    }

    @Override
    public List<Wechat> getSaveWechatBySearch(int sex) { return wechatMapper.selectSaveWechatBySearch(sex); }

    @Override
    public List<UserWechatSava> getSaveWechat() {
        return wechatMapper.selectUserWechatSava();
    }

    @Override
    public List<UserWechatTake> getTakeWechat() {
        return wechatMapper.selectUserWechatTake();
    }

    @Override
    public boolean saveWechat(Wechat wechat) {
        return wechatMapper.insertWechat(wechat);
    }

    @Override
    public int getWechatIdByWechatName(String wechat) {
        return wechatMapper.selectWechatIdByWechatName(wechat);
    }

    @Override
    public boolean saveUserWechatSave(Integer userId, Integer wechatId) {
        return wechatMapper.insertUserWechatSave(userId,wechatId);
    }

    @Override
    public boolean takeUserWechatSave(Integer userId, Integer wechatId) {
        return wechatMapper.insertUserWechatTake(userId,wechatId);
    }

    @Override
    public Wechat getWechat(String wechat) {
        return wechatMapper.selectWechat(wechat);
    }
}
